#include "../gba_types.h"

typedef struct{
	u8*		u0_;		//上
	u8*		u4_;		//下
	u8*		u8_;		//左
	u8*		uC_;		//右
	u8		u10_;		//屏幕X坐标
	u8		u11_;		//屏幕Y坐标
	u16		u12_;		//帮助索引,根据u18_函数指针
	u32		u14_;		//未确定
	u8*		u18_;		//0x0808AE21,函数指针显示的武器熟练度
}_cshow;

#define set_key_help(down,up,left,right) \
    	(void*)(up),			\
		(void*)(down),		        \
		(void*)(left),		    \
		(void*)(right)

#define set_pos(x,y) x,y
#define show_help_text(textId)              textId,0,(void*)(0x0808AE21)
#define show_char_help_text(id)             id,0,(void*)(0x808AE6+1)
#define show_help_text_ptr(id,value,pointer)     id,value,(void*)(pointer)
#define w_rank_x (0x68 )
#define w_rank_h 0x10
#define w_rank_y 0x18

static const _cshow sword_cshow;
static const _cshow spear_cshow;
static const _cshow axe_cshow;
static const _cshow bow_cshow;
static const _cshow staff_cshow;
static const _cshow anima_cshow;
static const _cshow light_cshow;
static const _cshow dark_cshow;

static const _cshow char_info0;
static const _cshow class_intro0;
static const _cshow level_help0;
static const _cshow exp_help0;
static const _cshow hp_help0;

static const _cshow sword_cshow = {
    set_key_help(&spear_cshow,&staff_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*0),
    show_help_text(0)
};

static const _cshow spear_cshow = {
    set_key_help(&axe_cshow,&sword_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*1),
    show_help_text(1)
};
static const _cshow axe_cshow = {
    set_key_help(&bow_cshow,&spear_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*2),
    show_help_text(2)
};
static const _cshow bow_cshow = {
    set_key_help(&anima_cshow,&axe_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*3),
    show_help_text(3)
};
static const _cshow staff_cshow = {
    set_key_help(&sword_cshow,&dark_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*7),
    show_help_text(7)
};
static const _cshow anima_cshow = {
    set_key_help(&light_cshow,&bow_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*4),
    show_help_text(4)
};
static const _cshow light_cshow = {
    set_key_help(&dark_cshow,&anima_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*5),
    show_help_text(5)
};
static const _cshow dark_cshow = {
    set_key_help(&staff_cshow,&light_cshow,&char_info0,0),
    set_pos(w_rank_x,w_rank_y+w_rank_h*6),
    show_help_text(6)
};


#define char_new_help(name,char_up,char_left,char_right,class_left,class_right,level_left,exp_right,hp_left,hp_right,hp_down) \
static const _cshow char_info##name;      \
static const _cshow class_intro##name;    \
static const _cshow level_help##name;     \
static const _cshow exp_help##name;       \
static const _cshow hp_help##name;        \
    \
static const _cshow char_info##name = { \
    set_key_help(&class_intro##name,char_up,char_left,char_right), \
    set_pos(0x18,0x50), \
    show_help_text_ptr(0,0,0x808AE60+1), \
}; \
static const _cshow class_intro##name = { \
    set_key_help(&level_help##name,&char_info##name,class_left,class_right), \
    set_pos(0x6,0x68), \
    show_help_text_ptr(0x66b,0,0x808AE8C+1), \
}; \
static const _cshow level_help##name = { \
    set_key_help(&hp_help##name,&class_intro##name,level_left,&exp_help##name), \
    set_pos(0x6,0x78), \
    show_help_text_ptr(0x4d7,0,0), \
}; \
static const _cshow exp_help##name = { \
    set_key_help(&hp_help##name,&class_intro##name,&level_help##name,exp_right), \
    set_pos(0x26,0x78), \
    show_help_text_ptr(0x4d8,0,0), \
}; \
static const _cshow hp_help##name = { \
    set_key_help(hp_down,&level_help##name,hp_left,hp_right), \
    set_pos(6,0x88), \
    show_help_text_ptr(0x4d9,0,0), \
};

char_new_help(0,0,0,&sword_cshow,0,&sword_cshow,0,&sword_cshow,0,&sword_cshow,0)

static const _cshow char_str;
static const _cshow char_magic;
static const _cshow char_kill;
static const _cshow char_speed;
static const _cshow char_luck;
static const _cshow char_def;
static const _cshow char_res;

#define def_show(name,up,down,left,right,x,y,textId,value,ptr) \
static const _cshow name = {                \
    set_key_help(down,up,left,right),        \
    set_pos(x,y),                            \
    show_help_text_ptr(textId,value,ptr),    \
};

static const _cshow char_info1;
static const _cshow class_intro1;
static const _cshow level_help1;
static const _cshow exp_help1;
static const _cshow hp_help1;

def_show(char_str,&char_res,&char_magic,   &char_info1,0,   0x66,0x18,0x4db,0,0);
def_show(char_magic,&char_str,&char_kill,  &char_info1,0,   0x66,0x18+0x10*1,0x4dc,0,0);
def_show(char_kill,&char_magic,&char_speed,&char_info1,0,   0x66,0x18+0x10*2,0x4dd,0,0);
def_show(char_speed,&char_kill,&char_luck, &char_info1,0,   0x66,0x18+0x10*3,0x4de,0,0);
def_show(char_luck,&char_speed,&char_def,  &char_info1,0,   0x66,0x18+0x10*4,0x4df,0,0);
def_show(char_def,&char_luck,&char_res,    &char_info1,0,   0x66,0x18+0x10*5,0x4e0,0,0);
def_show(char_res,&char_def,&char_str,     &char_info1,0,   0x66,0x18+0x10*6,0x4e1,0,0);
char_new_help(1,0,0,&char_str,0,&char_str,0,&char_str,0,&char_str,0)

static const _cshow char_info2;
static const _cshow class_intro2;
static const _cshow level_help2;
static const _cshow exp_help2;
static const _cshow hp_help2;

static const _cshow item0_help;
static const _cshow item1_help;
static const _cshow item2_help;
static const _cshow item3_help;
static const _cshow item4_help;
static const _cshow att_help;
static const _cshow hit_help;
static const _cshow cri_help;
static const _cshow avoid_help;
static const _cshow range_help;

def_show(item0_help,0,&item1_help,          &char_info2,0,0x68,0x18 + 0x10 * 0,0,0x808ADCC+1,0x808AC8C+1);
def_show(item1_help,&item0_help,&item2_help,&char_info2,0,0x68,0x18 + 0x10 * 1,1,0x808ADCC+1,0x808AC8C+1);
def_show(item2_help,&item1_help,&item3_help,&char_info2,0,0x68,0x18 + 0x10 * 2,2,0x808ADCC+1,0x808AC8C+1);
def_show(item3_help,&item2_help,&item4_help,&char_info2,0,0x68,0x18 + 0x10 * 3,3,0x808ADCC+1,0x808AC8C+1);
def_show(item4_help,&item3_help,&att_help,  &char_info2,0,0x68,0x18 + 0x10 * 4,4,0x808ADCC+1,0x808AC8C+1);

def_show(att_help,  &item4_help,&hit_help,  &exp_help2, &cri_help   ,0x76,0x78,0x4f1,0,0);
def_show(hit_help,  &att_help,  0,          &exp_help2, &avoid_help ,0x76,0x88,0x4f2,0,0);
def_show(cri_help,  &range_help,&avoid_help,&att_help  ,0,           0xae,0x78,0x4f4,0,0);
def_show(avoid_help,&cri_help  ,0,          &hit_help  ,0,           0xae,0x88,0x4f5,0,0);
def_show(range_help,&item4_help,&cri_help,  &att_help,  0,           0xae,0x68,0x4f3,0,0);

char_new_help(2,0,0,&att_help,0,&att_help,0,&att_help,0,&att_help,0)

static const _cshow char_move,char_cons,char_a1,char_a2,char_ali,char_status,char_comp;
static const _cshow char_info3;
static const _cshow class_intro3;
static const _cshow level_help3;
static const _cshow exp_help3;
static const _cshow hp_help3;
//角色移动显示帮助
def_show(char_move, &char_status,&char_cons,&char_info3,0,0x66,0x18 + 0 * 0x10,0x4e2 /*文本id*/,0,0);
def_show(char_cons, &char_move,&char_a1,    &char_info3,0,0x66,0x18 + 1 * 0x10,0x4e3,0,0);
def_show(char_a1,   &char_cons,&char_a2,    &char_info3,0,0x66,0x18 + 2 * 0x10,0x4e4,0,0);
def_show(char_a2,   &char_a1,&char_ali,     &char_info3,0,0x66,0x18 + 3 * 0x10,0x4e5,0,0);
def_show(char_ali,  &char_a2,&char_status,  &char_info3,0,0x66,0x18 + 4 * 0x10,0x4e6,0,0);
def_show(char_status,&char_ali,&char_move,  &char_info3,0,0x66+0x10,0x18 + 5 * 0x10,0x0,0,0x808ACB8+1);

//def_show(char_comp, &char_a1,&char_ali,    &char_a2 ,0,0x66+0x10,0x18 + 3 * 0x10,0x0,0,0x808ACB8+1);

char_new_help(3,0,0,&char_move,0,&char_move,0,&char_move,0,&char_move,0)

char_new_help(9,0,0,0,0,0,0,0,0,0,0)
